<!--
 * @Author: 'yangyuhang1203' '2621131059@qq.com'
 * @Date: 2025-09-10 09:47:39
 * @LastEditors: 'yangyuhang1203' '2621131059@qq.com'
 * @LastEditTime: 2025-09-10 14:34:15
 * @FilePath: \企业级\前端\js\对象\DOM对象.html
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>DOM演示</title>
</head>
    <body onload="load()">
    <form action="" style="text-align: center;" onsubmit="subfn()">
    <input type="text" name="username" onblur="bfn()" onfocus="ffn()" onkeydown="kfn()">
    <input id="b1" type="submit" value="提交">
    <input id="btn1" type="button" value="单击事件" onclick="fn1()">
    </form>
    <br><br><br>
<body>
    <div style="font-size: 30px; text-align: center;" id="tb1">课程表</div>
    <table width="800px" border="1" cellspacing="0" align="center">
    <!-- // 创建一个表格，宽度 800px，边框 1px，单元格间距 0，整体居中对齐 -->
        <!-- <tr> -->
            <th>学号</th>
            <th>姓名</th>
            <th>分数</th>
            <th>评语</th>
            </tr>
            <tr align="center" class="data">
                <!-- 每个数据行都有class="data"以便 JavaScript 选择 -->
            <td>001</td>
            <td>张三</td>
            <td>90</td>
            <td>很优秀</td>
            </tr>
            <tr align="center" class="data">
            <td>002</td>
            <td>李四</td>
            <td>92</td>
            <td>优秀</td>
            </tr>
            <tr align="center" class="data">
            <td>003</td>
            <td>王五</td>
            <td>83</td>
            <td>很努力,不错</td>
            </tr>
            <tr align="center" class="data">
            <td>004</td>
            <td>赵六</td>
            <td>98</td>
            <td>666</td>
        <!-- </tr> -->
    </table>
    <script>
        //onload : 页面/元素加载完成后触发
        function load(){
        console.log("页面加载完成...")
        }
        //onclick: 鼠标点击事件
        function fn1(){
        console.log("我被点击了...");
        }
        //onblur: 失去焦点事件
        function bfn(){
        console.log("失去焦点...");
        }
        //onfocus: 元素获得焦点
        function ffn(){
        console.log("获得焦点...");
        }
        //onkeydown: 某个键盘的键被按下
        function kfn(){
        console.log("键盘被按下了...");
        }
        //onmouseover: 鼠标移动到元素之上
        function over(){
        console.log("鼠标移入了...")
        }
        //onmouseout: 鼠标移出某元素
        function out(){
        console.log("鼠标移出了...")
        }
        //onsubmit: 提交表单事件
        function subfn(){
        alert("表单被提交了...");
        }
    </script>
</body>
</html>